﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace QGZX.Filters
{
    public class HandleError:HandleErrorAttribute
    {
        /// <summary>
        /// 全局异常处理类，发布网站后开启
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnException(ExceptionContext filterContext)
        {
            //获取异常对象
            Exception ex = filterContext.Exception;
            //记录异常日志

            //重定向错误友好页面
            filterContext.Result = new RedirectResult("~/Error.html");
            //标记此异常已经处理，否则将会继续引发异常
            filterContext.ExceptionHandled = true;

            base.OnException(filterContext);
        }
    }
}